package com.zf.nio.channel;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.DatagramChannel;

/**
 * @author Zhou Feng
 */
public class DatagramChannelDemo02 {
    public static void main(String[] args) throws IOException {
        DatagramChannel server = DatagramChannel.open();
        try(server){
            ByteBuffer sendBuffer = ByteBuffer.wrap("client send".getBytes());
            //通过 send()发送 UDP
            server.send(sendBuffer, new InetSocketAddress("127.0.0.1",10086));
        }

    }
}
